/**
 * 数据角色service
 * @author 李艳
 */
import httpUtils  from "../../../commons/utils/FeatchUtils";
import {basicUrl} from "../../../configs/DefaultConfig"
import {convertDataToFormData} from "../../../commons/utils/CommonUtils";

/**
 * 获得组织机构下所有岗位
 *
 * param organizationId 组织机构ID
 */
export async function findAllDataRoleGroup(params={}){
    return httpUtils.get(basicUrl+"/dataRoleGroup/findAll",params);
}

export async function findAllDataRole(params={}){
    return httpUtils.get(basicUrl+"/dataRole/findByDataRoleGroup",params);
}

export async function saveDataRoleGroup(params={}){
    return httpUtils.postJson(basicUrl+"/dataRoleGroup/save",params);
}

export async function saveDataRole(params={}){
    return httpUtils.postJson(basicUrl+"/dataRole/save",params);
}

export async function deleteDataRoleGroup(param=""){
    return httpUtils.delete(basicUrl+"/dataRoleGroup/delete",param);
}
export async function deleteDataRole(param=""){
    return httpUtils.delete(basicUrl+"/dataRole/delete",param);
}
export async function listAllUserType(params={}){
    return httpUtils.get(basicUrl+"/featureRole/listAllUserType",params);
}

export async function listDataAuthorizeTypeByDataRole(params={}){
    return httpUtils.get(basicUrl+"/dataAuthorizeType/getByDataRole",params);
}
export async function listAllTenantAppModules(params = {}) {
    return httpUtils.get(basicUrl + "/tenantAppModule/getTenantAppModules", params);
}
export async function listDataAuthorizeTypeByAppModuleAndDataRole(params = {}) {
    return httpUtils.get(basicUrl + "/dataAuthorizeType/getByAppModuleAndDataRole", params);
}
export async function listAllAssignedAuthDatas(params=""){
    return httpUtils.get(basicUrl+"/dataRoleAuthTypeValue/getAssignedAuthDatas",params);
}
export async function listAllUnAssignedAuthDatas(params=""){
    return httpUtils.get(basicUrl+"/dataRoleAuthTypeValue/getUnassignedAuthDataList",params);
}

export async function listAllAssignedAuthTreeDatas(params=""){
    return httpUtils.get(basicUrl+"/dataRoleAuthTypeValue/getAssignedAuthTreeDataList",params);
}
export async function listAllUnAssignedAuthTreeDatas(params=""){
    return httpUtils.get(basicUrl+"/dataRoleAuthTypeValue/getUnassignedAuthTreeDataList",params);
}
export async function removeRelationsByParam(params={}){
    return httpUtils.postJson(basicUrl+"/dataRoleAuthTypeValue/removeRelations",JSON.stringify(params));
}
export async function insertRelationsByParam(params={}){
    return httpUtils.postJson(basicUrl+"/dataRoleAuthTypeValue/insertRelations",JSON.stringify(params));
}
